import json
import urllib3

def push_result(context):
    '''
    打包成功结束通知
    '''
    data = {
        "msg_type": "text",
        "content": {
            "text": json.dumps(context).replace("{", "{\n\t").replace(",", ",\n\t").replace("}", "\n}")
        }
    }

    headers = {'Accept-Charset': 'utf-8', 'Content-Type': 'application/json'}
    webhook = "https://open.feishu.cn/open-apis/bot/v2/hook/3b58416e-5921-4226-8bac-2eb8e3e6c4aa"

    print(json.dumps(data))
    http = urllib3.PoolManager()
    r = http.request(
        "POST",
        webhook, 
        body=json.dumps(data).encode("utf-8"),
        headers=headers)

    if r.status == 200:
        reponse = r.data
        if len(reponse) > 0:
            print(json.loads(reponse))